<include file="public:header" />

<br />
<br />
<br />
<div class="container">
    <form id="formBox" role="form" action="index.php?g=api&m=thread&a=addComment" method="post">
  <div class="form-group">
    <label for="threadId">帖子id</label>
    <input type="text" name="threadId" class="form-control" id="threadId">
  </div>
  <div class="form-group">
    <label for="content">回帖内容</label>
    <input type="text" name="content" class="form-control" id="content">
  </div>
  <div class="form-group">
    <label for="attachment1">图片1</label>
    <input type="file" name="attachment[]" id="attachment1">
  </div>
  <div class="form-group">
    <label for="attachment2">图片2</label>
    <input type="file" name="attachment[]" id="attachment2">
  </div>
  <button type="submit" class="btn btn-default">Submit</button>
</form>
</div>


<script type="text/javascript">
$(document).ready(function(){
    //绑定一个指定的表单
    $('#formBox').ajaxForm({ 
            //设置传输的数据类型
            dataType:  'json', 
            //请求成功后，调用的回调函数
            success:  back
    }); 

    function back(data){
        if(data.status === 200){
            alert(data.msg);
            console.log(data.data);
        }else{
           alert(data.msg);
        }
    }
});


</script>

<include file="public:footer" />